package cn.itsource.quartz;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;
import java.util.Date;

//querzt作业，实现job接口
public class PrintTimeJob implements Job {
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss SSS");
        String dataStr = dateFormat.format(new Date());
        System.out.println(dataStr);

        //获取参数
        Object params = context.getJobDetail().getJobDataMap().get("params");
        System.out.println(params);

    }
}
